package com.itheima.stock;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexExample {
    public static void main(String[] args) {
        String text = "Is this a question? Yes, it is a question?";

        // 使用正则表达式 \\? 来匹配问号
        Pattern pattern = Pattern.compile("(.+?)\\?");
        Matcher matcher = pattern.matcher(text);

        // 查找并匹配第一个问号
        while (matcher.find()) {
            System.out.println("found value: " + matcher.group(1));
        }
    }
}
